<!DOCTYPE html>
<html lang='zh-CN'>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
<style>

</style>
</head>
<body>
<input type="file">
<img src="" alt="">
<script>
    const input= document.querySelector('input')
    const img = document.querySelector('img')
    input.addEventListener('change',function (e) {
        const file=e.target.files[0]
        const url=URL.createObjectURL(file)
        img.src=url 
    })
</script>
</body>
</html>